<template>
	<view class="withdrawaljl-page">
		<u-navbar title="提现记录" :placeholder="true" :autoBack="true" bgColor="rgba(0,0,0,0.0)">
		</u-navbar>
		<view class="tabs">
			<view :class="item.show == true?'activity-item':''" class="tabs-item" v-for="(item,index) in tabsLits"
				:key="index" @click="cutTbas(index)">
				{{item.text}}
			</view>
		</view>
		<view class="info-list">
			<view class="ability" v-if="list.length>0">
				<view class="ability-item" v-for="(item,index) in list" :key="index" @click="gonavto(item.url)">
					<image :src="item.payoutsUrl" mode="aspectFill"></image>
					<view class="ability-right">
						<view class="ability-text">
							提现金额：{{item.payoutsAmount}}
						</view>
						<view class="ability-time">
							时间：{{item.createTime}}
						</view>
					</view>
				</view>
			</view>
			<u-loadmore :status="status" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				status: 'loadmore',
				tabsLits: [{
						text: '待审核',
						show: true
					},
					{
						text: '提现成功',
						show: false
					},
					{
						text: '提现失败',
						show: false
					}
				],
				index: 1
			}
		},
		onLoad() {
			this.postlist()
		},
		onReachBottom() {
			this.page = this.page + 1
			this.status = 'loading';
			this.postrelist()
		},
		methods: {
			cutTbas(index) {
				this.tabsLits.map(item => {
					item.show = false
				})
				this.tabsLits[index].show = true
				this.index = index + 1
				this.page = 1
				this.postlist()
			},
			postlist() {
				let params = {
					pageNum: this.page,
					pageSize: 10,
					payoutsStatus: this.index
				}
				this.$Request({
					method: 'GET',
					url: '/api/member/record/list',
					data: params,
					ismsg: false,
				}).then(res => {
					console.log(res)
					if (res.code == 200) {
						if (res.rows.length < 10) {
							this.status = 'nomore';
						}
						if (this.page == 1) {
							this.list = res.rows
						} else {
							this.list = [...this.list, ...res.rows]
						}
					}
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.withdrawaljl-page {
		min-height: calc(100vh - 91rpx);
		background-image: url('../../../static/goods/top-bg.png');
		background-size: 100% 561rpx;
		background-repeat: no-repeat;
		padding: 30rpx;

		.tabs {
			width: 100%;
			display: flex;
			justify-content: space-between;
			background-color: #ffffff;
			padding: 6rpx;
			border-radius: 40rpx;
			margin: 0 auto;

			.tabs-item {
				width: 50%;
				padding: 20rpx;
				border-radius: 40rpx;
				font-size: 28rpx;
				color: #333333;
				font-weight: bold;
				text-align: center;
			}

			.activity-item {
				color: #ffffff;
				background: linear-gradient(90deg, #FE8A03 0%, #FA5900 100%);
			}
		}

		.info-list {
			.ability {
				margin-top: 20rpx;
				box-shadow: 0rpx 0rpx 16rpx 1rpx rgba(0, 0, 0, 0.08);
				padding: 20rpx;
				background-color: #ffffff;
				border-radius: 30rpx;

				.ability-item {
					display: flex;
					align-items: center;
					margin-bottom: 30rpx;

					image {
						width: 120rpx;
						height: 120rpx;
						border-radius: 20rpx;
					}

					.ability-right {
						margin-left: 20rpx;

						.ability-text {
							font-size: 28rpx;
							color: #000000;
						}

						.ability-time {
							margin-top: 10rpx;
							font-size: 28rpx;
							color: #000000;
						}
					}
				}

				.ability-item:last-child {
					border-bottom: none;
					margin-bottom: 0;
				}
			}
		}
	}
</style>